package com.jiang;

import com.jiang.config.SpringConfig;
import com.jiang.dao.BookDao;
import com.jiang.service.BookService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class AppForAnnotation {
    public static void main(String[] args) {
        
        ApplicationContext applicationContext = new AnnotationConfigApplicationContext(SpringConfig.class);
        
        BookDao bookDao = (BookDao) applicationContext.getBean("bookDao");
//        BookDao bookDao1 = (BookDao) applicationContext.getBean("bookDao");
        System.out.println(bookDao);
        bookDao.save();
//        System.out.println(bookDao1);
        BookService bookService = (BookService) applicationContext.getBean(BookService.class);
        System.out.println(bookService);
        bookService.save();
        
    }
}
